/*
 *  $Id: Faerie.cs 1046 2010-05-18 12:17:04Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Races {
    public class Faerie: Race {
        public Faerie(): base("faerie") {}

        public override void SetNaturalAffects(CreatureCard card, ICollector<Affect> affects) {
            affects.Add<FaerieAffect>();
        }

        private class FaerieAffect: Affect {
            private static readonly Languages.Phrase ManaReturn = new Languages.Phrase("race.faerie.mana_return.affect");

            public FaerieAffect(): base() {}

            public override string Id {
                get { return "faerie.mana_return"; }
            }
            public override Languages.Phrase Name {
                get { return ManaReturn; }
            }

            public override void SetAffect() {
                base.SetAffect();
                LocalSummary.OnDeath += DoDeath;
            }
            public override void ResetAffect() {
                base.ResetAffect();
                LocalSummary.OnDeath -= DoDeath;
            }

            private static void DoDeath(AbstractObject obj) {
                Creature cr = obj as Creature;
                if (cr != null) cr.Owner.IncrementMana(ElementType.Air, cr.Card.GetSumManaFor(cr.Owner)+1);
            }
        }
    }
}
